package com.example.leetcode.demo.leetcode;

public class reverseString {
    public static void main(String[] args) {
        char [] nums=new char[]{'h','e','l','l','o'};
        reverseString(nums);
        for(int k=0;k<nums.length;k++){
            System.out.print(nums[k]);
        }
    }
    private static void reverseString(char[] s){
        int left=0,right=s.length-1;
        while (left<=right){
            char temp=s[left];
            s[left]=s[right];
            s[right]=temp;
            left++;
            right--;
        }
    }
}
